package com.example.manager.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import com.example.manager.entity.ScoreComposition;
import com.example.manager.service.ScoreCompositionService;

@RestController
public class ScoreCompositionController {
	
	@Autowired
	private ScoreCompositionService service;
	
	@GetMapping("scoreCompositionByCTid/{ctid}")
	public List<ScoreComposition> getByCSid(@PathVariable Integer ctid) {
		return service.getScoreCompositionByCourseTeachingId(ctid);
	}
	
	@PostMapping("scoreComposition")
	public String addScoreComposition(ScoreComposition sc) {
		return service.addScoreComposition(sc);
	}
	
	@DeleteMapping("scoreComposition/{id}")
	public String delScoreComposition(@PathVariable Integer id) {
		return service.deleteScoreComposition(id);
	}
	
}
